<%--<%@ page import="com.shop.service.StudentService" %>--%>
<%--<%@ page import="com.shop.model.Student" %>&lt;%&ndash;--%>
<%--  Created by IntelliJ IDEA.--%>
<%--  User: Administrator--%>
<%--  Date: 2025/4/6--%>
<%--  Time: 下午11:08--%>
<%--  To change this template use File | Settings | File Templates.--%>
<%--&ndash;%&gt;--%>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<%--<html>--%>
<%--<head>--%>
<%--    <title>首页</title>--%>
<%--</head>--%>
<%--<body>--%>
<%--    <%--%>
<%--        StudentService studentService = new StudentService();--%>
<%--        String studentId1 = (String) request.getAttribute("studentId");--%>
<%--        String studentId2 = request.getParameter("studentId");--%>
<%--        String studentId = studentId1==null?studentId2:studentId1;--%>
<%--        System.out.println("welcome.jsp:18:"+studentId);--%>
<%--        Student student = studentService.search(studentId);--%>
<%--    %>--%>
<%--    <%if(studentId ==null){--%>
<%--        response.sendRedirect("login.jsp");--%>
<%--    }else{%>--%>
<%--    <a href="message.jsp?studentId=<%=studentId%>">欢迎您，<% if(student.getName()!=null){--%>
<%--        out.print(student.getName());--%>
<%--    }else {--%>
<%--        out.print(student.getStudentId());--%>
<%--    }%></a>--%>
<%--    <a href="course.jsp?studentId=<%=studentId%>">课程</a>--%>
<%--    <a href="register.jsp">注册</a>--%>
<%--    <a href="cart.jsp?studentId1=<%=studentId%>">购物车</a>--%>
<%--    <a href="recharge.jsp?studentId=<%=studentId%>">充值</a>--%>
<%--    <a href="my_order.jsp?studentId=<%=studentId%>">我的订单</a>--%>
<%--    <a href="${pageContext.request.contextPath}/logout"--%>
<%--       onclick="event.preventDefault(); document.getElementById('logoutForm').submit();">--%>
<%--        退出登录--%>
<%--    </a>--%>
<%--    <form id="logoutForm" action="${pageContext.request.contextPath}/logout" method="post" style="display:none;">--%>
<%--        <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>--%>
<%--    </form>--%>
<%--    <%}%>--%>
<%--</body>--%>
<%--</html>--%>


<%@ page import="com.shop.service.StudentService" %>
<%@ page import="com.shop.model.Student" %>
<%@ page import="com.shop.service.IStudentService" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/4/6
  Time: 下午11:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        .header {
            background-color: #2c3e50;
            color: white;
            padding: 20px 0;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .welcome-message {
            font-size: 18px;
            font-weight: 500;
            color: #ecf0f1;
            text-decoration: none;
            transition: color 0.3s;
        }

        .welcome-message:hover {
            color: #3498db;
        }

        .nav-links {
            display: flex;
            gap: 15px;
        }

        .nav-link {
            color: #ecf0f1;
            text-decoration: none;
            padding: 8px 15px;
            border-radius: 4px;
            transition: all 0.3s;
            font-weight: 500;
        }

        .nav-link:hover {
            background-color: #3498db;
            transform: translateY(-2px);
        }

        .logout-btn {
            background-color: #e74c3c;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s;
        }

        .logout-btn:hover {
            background-color: #c0392b;
            transform: translateY(-2px);
        }

        .main-content {
            padding: 40px 0;
            text-align: center;
        }

        .welcome-title {
            font-size: 30px;
            margin-bottom: 20px;
            color: #2c3e50;
        }

        .subtitle {
            font-size: 18px;
            color: #7f8c8d;
            margin-bottom: 30px;
        }
    </style>
</head>
<body>
<%
    IStudentService istudentService = new StudentService();
    String studentId1 = (String) request.getAttribute("studentId");
    String studentId2 = request.getParameter("studentId");
    String studentId = studentId1==null?studentId2:studentId1;
    System.out.println("welcome.jsp:18:"+studentId);
    Student student = istudentService.search(studentId);
%>
<%if(studentId ==null){
    response.sendRedirect("login.jsp");
}else{%>
<div class="header">
    <div class="container">
        <div class="nav">
            <p  class="welcome-message">
                欢迎您，<% if(student.getName()!=null){
                out.print(student.getName());
            }else {
                out.print(student.getStudentId());
            }%>
            </p>

            <div class="nav-links">
                <a href="vip.jsp?studentId=<%=studentId%>" class="nav-link">VIP</a>
                <a href="course.jsp?studentId=<%=studentId%>" class="nav-link">课程</a>
                <a href="register.jsp" class="nav-link">注册</a>
                <a href="cart.jsp?studentId1=<%=studentId%>" class="nav-link">购物车</a>
                <a href="recharge.jsp?studentId=<%=studentId%>" class="nav-link">充值</a>
                <a href="my_order.jsp?studentId=<%=studentId%>" class="nav-link">我的订单</a>
                <a href="my_course.jsp?studentId=<%=studentId%>" class="nav-link">我的课程</a>
                <a href="message.jsp?studentId=<%=studentId%>" class="nav-link">个人中心</a>
                <a href="${pageContext.request.contextPath}/logout" class="logout-btn"
                   onclick="event.preventDefault(); document.getElementById('logoutForm').submit();">
                    退出登录
                </a>
                <form id="logoutForm" action="${pageContext.request.contextPath}/logout" method="post" style="display:none;">
                    <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="main-content">
    <div class="container">
        <h2 class="welcome-title">欢迎使用选课系统(学生端)</h2>
    </div>
</div>
<%}%>
</body>
</html>